package me.huanmeng.heater.signalling.extra.data.event;

import lombok.Data;
import lombok.EqualsAndHashCode;
import me.huanmeng.heater.Heater;
import me.huanmeng.heater.object.Guild;
import me.huanmeng.heater.signalling.extra.SignallingExtraData;

/**
 * 2021/10/5<br>
 * Heater<br>
 *
 * @author huanmeng_qwq
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class GuildDelete extends SignallingExtraData<String> {
    protected GuildDeleteBody body;
    @Data
    public static class GuildDeleteBody {
        protected String id;
        protected String name;
        protected String icon;
        protected int notify_type;
        protected String region;
        protected boolean enable_open;
        protected String open_id;
        protected String default_channel_id;
        protected String welcome_channel_id;
    }
    @Override
    public void execute() {
        final Guild guild = Heater.getGuild(body.getId());
        guild.setName(body.getName());
        guild.setIcon(body.getIcon());
        guild.setNotify_type(body.getNotify_type());
        guild.setRegion(body.getRegion());
        guild.setEnable_open(body.isEnable_open());
        guild.setOpen_id(body.getOpen_id());
        guild.setDefault_channel_id(body.getDefault_channel_id());
        guild.setWelcome_channel_id(body.getWelcome_channel_id());
    }
}
